<template>
<div class="">
    <div class="pr10">
        <div class="analyItem">
            <p class="analyItemTit tx-center">状态</p>
            <div class="analyItemCon">

            </div>
        </div>
    </div>
    <div class="thinScroll pr10" v-scrollHeight="100">
        <!-- <router-link tag="div" exact v-for="(item, index) in 10" :key="index" :to="routerPath(`informationPoint?index=${index+1}`)" class="analyItem anItemBor" active-class="anItemBor-active">
            <p class="analyItemTit tx-center">点位{{ index + 1 }}</p>
            <div class="analyItemCon">

            </div>
        </router-link> -->
        <router-link tag="div" :to="routerPath('informationConfirm')" class="analyItem anItemBor" active-class="anItemBor-active">
            <p class="analyItemTit tx-center">指定出库</p>
            <div class="analyItemCon">
                <!-- <p class="col-md-4"><span class="cLightGray pr8">监控名称</span><span>{{ twoInfo.camera_name }}</span></p>
                <p class="col-md-4">
                    <span class="cLightGray pr8">库存状态</span>
                    <span v-if="twoInfo.camera_state === 0">库存</span>
                    <span v-else-if="twoInfo.camera_state === 1">已出库</span>
                    <span v-else>已归库</span>
                </p> -->
                <p class="col-md-4"><span class="cLightGray pr8">时间</span><span>{{ twoInfo.update_date }}</span></p>
                <p class="col-md-4"><span class="cLightGray pr8">操作人</span><span>{{ userInfo.as_fullName }}</span></p>
                <p>
                    <span class="circlemark circlemark-purple" v-if="(this.twoToThreeInfo.point_state === null || this.twoToThreeInfo.point_state === '') && this.twoToThreeInfo.camera === null">待</span>
                    <span class="circlemark circlemark-lightGreen" v-else>完</span>
                </p>
            </div>
        </router-link>
        <!-- <router-link tag="div" :to="{name: 'informationSetting', params: nowPoints}" class="analyItem anItemBor" active-class="anItemBor-active">
            <p class="analyItemTit tx-center">拍摄设置</p>
            <div class="analyItemCon">
                <p class="col-md-4"><span class="cLightGray pr8">开始时间</span><span>{{ nowPoints.begin_date }}点/天</span></p>
                <p class="col-md-4"><span class="cLightGray pr8">结束时间</span><span>{{ nowPoints.end_data }}点/天</span></p>
            </div>
        </router-link> -->
        <router-link tag="div" :to="routerPath('informationInstall')" class="analyItem anItemBor" active-class="anItemBor-active">
            <p class="analyItemTit tx-center">安装</p>
            <div class="analyItemCon">
                <span class="cRed">--</span>
                <p>
                    <span class="circlemark circlemark-purple" v-if="Number(this.twoToThreeInfo.install_state) === 0">待</span>
                    <span class="circlemark circlemark-lightGreen" v-else>完</span>
                </p>
            </div>
        </router-link>
        <router-link tag="div" :to="routerPath('informationPhotograph?pointId='+pointsInfo.id)" class="analyItem anItemBor" active-class="anItemBor-active">
            <p class="analyItemTit tx-center">拍照</p>
            <div class="analyItemCon">
                <p class="col-md-4"><span class="cLightGray pr8">拍摄</span><span>{{ twoInfo.img_date === 0 ? 1 : (twoInfo.img_date + 1) }}天</span></p>
                <p class="col-md-4"><span class="cLightGray pr8">共</span><span>{{ twoInfo.imgs }}张</span></p>
                <p>
                    <span class="circlemark circlemark-lightGreen" v-if="Number(this.twoToThreeInfo.point_state) === 1">完</span>
                    <span class="circlemark circlemark-purple" v-else>待</span>
                </p>
            </div>
        </router-link>
        <router-link tag="div" :to="routerPath('informationUntying')" class="analyItem anItemBor" active-class="anItemBor-active">
            <p class="analyItemTit tx-center">解绑</p>
            <div class="analyItemCon">
                <span class="cRed">--</span>
                <p>
                    <span class="circlemark circlemark-lightGreen" v-if="Number(this.twoToThreeInfo.point_state) === 1">完</span>
                    <span class="circlemark circlemark-purple" v-else>待</span>
                </p>
            </div>
        </router-link>
    </div>
    <div class="layerRtb-footer" style="padding-left: 0px;">
        <router-link tag="div" :to="routerPath('informationHander')" class="analyItem anItemBor" active-class="anItemBor-active">
            <p class="analyItemTit tx-center">处理</p>
            <div class="analyItemCon">
            </div>
        </router-link>
    </div>
</div>
</template>
<script>
// vuex
import { mapGetters } from 'vuex'
// Api
import { getSauxiliaryInfo } from '../../../branches/Department/Resources/Api/index'
import { getTow } from '../Resources/Api/index'
export default {
    props: ['pointsInfo'],
    data () {
        return {
            nowPoints: {
                begin_date: '',
                end_data: '',
                interval: ''
            }, // 当前点位详情信息
            twoInfo: {
                begin_date: 0,
                camera: '',
                camera_name: '',
                camera_state: 0,
                img_date: 0,
                end_data: 0,
                imgs: 0,
                update_date: ''
            }
        }
    },
    created () {
        // this._getSauxiliaryInfoFn()
        if (this.pointsInfo.camera !== null && this.pointsInfo.id !== null) {
            this._getTowFn()
        }
    },
    methods: {
        // 路由跳转路径拼接
        routerPath (path) {
            return this.$route.matched[1].path + '/' + path
        },
        // 直接进行路由跳转路径
        routerPush (path) {
            this.$router.push(this.$route.matched[1].path + '/' + path)
        },
        /* 根据点位camera获取详情信息 */
        _getSauxiliaryInfoFn () {
            this.nowPoints = {
                begin_date: '',
                end_data: '',
                interval: ''
            }
            let params = {
                camera: this.pointsInfo.camera
            }
            getSauxiliaryInfo(params).then((result) => {
                if (result.data.StatusCode === 0) {
                    if (JSON.stringify(result.data.Body.orderList) !== '[]') {
                        this.nowPoints = result.data.Body.orderList[0]
                        // this.$set(this.twoToThreeInfo, 'camereDetail', result.data.Body.orderList[0])
                    }
                }
            }).catch((err) => {
                console.log(`根据点位camera获取详情信息接口错误,错误内容${err}`)
            })
        },
        /* 按点位查询拍摄的二段信息 */
        _getTowFn () {
            this.twoInfo = {
                begin_date: 0,
                interval: 0,
                camera: '',
                camera_name: '',
                camera_state: 0,
                img_date: 0,
                end_data: 0,
                imgs: 0
            }
            this.nowPoints = {
                begin_date: '',
                end_data: '',
                interval: ''
            }
            let params = {
                camera: this.pointsInfo.camera,
                point_id: this.pointsInfo.id
            }
            getTow(params).then((result) => {
                if (result.data.StatusCode === 0) {
                    if (JSON.stringify(result.data.Body.orderList) !== '[]') {
                        this.twoInfo = result.data.Body.pointMap
                        this.nowPoints = result.data.Body.pointMap
                        // this.twoToThreeInfo.push('begin_date', this.twoInfo.begin_date)
                        // this.twoToThreeInfo.push('end_data', this.twoInfo.end_data)
                        // this.twoToThreeInfo.push('interval', this.twoInfo.interval)
                    }
                }
            }).catch((err) => {
                console.log(`按点位查询拍摄的二段信息接口错误,错误内容${err}`)
            })
        }
    },
    watch: {
        pointsInfo () {
            // this._getSauxiliaryInfoFn()
            // if (this.pointsInfo.camera !== null && this.pointsInfo.id !== null) {
            //     this._getTowFn()
            // }
        },
        updatePlate () {
            this._getTowFn()
        }
    },
    computed: {
        ...mapGetters(['twoToThreeInfo', 'leftInfo', 'userInfo', 'updatePlate'])
    }
}
</script>
